package units;

public class GameTime extends Time {

    private static final long serialVersionUID = 7469101720068748565L;
    private long ms;
    public static final long MS_SEG = 10;

    public GameTime() {
        this(0, 0);
    }

    public GameTime(long segundosTotais, long ms) {
        super(segundosTotais);
        this.ms = ms;
    }

    public long getMs() {
        return ms;
    }

    public void addMS(int ms) {
        this.ms += ms;
        this.simplificar();
    }

    @Override
    public void simplificar() {
        if (this.ms < 0 || this.ms > MS_SEG) {
            this.segundo += this.ms / MS_SEG;
            this.ms %= MS_SEG;
        }
        super.simplificar();
    }
}
